//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Resource Application Block
//===============================================================================

using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;

namespace EntLibContrib.Resource.Configuration
{
	/// <summary>
	/// Overall configuration settings for Resources
	/// </summary>    
	public class ResourceSettings : SerializableConfigurationSection
	{
		#region Constants
		/// <summary>
		/// Configuration key for resource settings.
		/// </summary>
		public const string SectionName = "resourceConfiguration";
		private const string defaultResourceManagerProperty = "defaultResourceManager";
		private const string resourceManagersProperty = "resourceManagers";
		private const string resourceProvidersProperty = "resourceProviders";
		#endregion

		#region Properties
		/// <summary>
		/// Defines the default manager instance to use when no other manager is specified
		/// </summary>
		[ConfigurationProperty(defaultResourceManagerProperty, IsRequired = true)]
		public string DefaultResourceManager
		{
			get { return (string)base[defaultResourceManagerProperty]; }
			set { base[defaultResourceManagerProperty] = value; }
		}

		/// <summary>
		/// Gets the collection of defined <see cref="IResourceManager"/> objects.
		/// </summary>
		/// <value>
		/// The collection of defined <see cref="IResourceManager"/> objects.
		/// </value>
		[ConfigurationProperty(resourceManagersProperty, IsRequired = true)]
		public NameTypeConfigurationElementCollection<ResourceManagerDataBase, CustomResourceManagerData> ResourceManagers
		{
			get { return (NameTypeConfigurationElementCollection<ResourceManagerDataBase, CustomResourceManagerData>)base[resourceManagersProperty]; }
		}

		/// <summary>
		/// Gets the collection of defined <see cref="IResourceProvider"/> objects.
		/// </summary>
		/// <value>
		/// The collection of defined <see cref="IResourceProvider"/> objects.
		/// </value>
		[ConfigurationProperty(resourceProvidersProperty, IsRequired = false)]
		public NameTypeConfigurationElementCollection<ResourceProviderDataBase, CustomResourceProviderData> ResourceProviders
		{
			get { return (NameTypeConfigurationElementCollection<ResourceProviderDataBase, CustomResourceProviderData>)base[resourceProvidersProperty]; }
		}
		#endregion

		#region Construction
		/// <summary>
		/// Initializes a new instance of the <see cref="ResourceSettings"/> class.
		/// </summary>
		public ResourceSettings()
		{
		}
		#endregion
	}
}